//index.js
//获取应用实例
var app=getApp();
import {Index} from "./index-model.js";
var main=new Index();

Page({
  data: {
    list:["推荐","排行榜","歌手","新碟上架"],
    currentIndex:0,
    currentId:-1
  },
  
  onLoad: function () {
    var groomList=[
      {
        "image":"http://p1.music.126.net/eOpBA3vOWDbijBLiBWfX7w==/18572950418611715.jpg?param=140y140",
        "title":"有意思！这些歌的歌名居然对着唱反调",
        "id":"2246886256"
      },
      {
        "image":"http://p1.music.126.net/Fl4oxDhwjnC4Si6qG9PQqg==/109951163351868649.jpg?param=140y140",
        "title":"熬夜宣言丨点燃深夜荷尔蒙",
        "id":"2268545136"
      },
      {
        "image":"http://p1.music.126.net/Yt-kigpvcK6Uwe6x1tsG7Q==/18950082905279208.jpg?param=140y140",
        "title":"三行情诗，目光所及处，余生全是你",
        "id":"2224587176"
      },
      {
        "image":"http://p1.music.126.net/xGq0lsDm3sRWlQedfgggZQ==/109951163352013984.jpg?param=140y140",
        "title":"杨梅要是没洗好，就是一道“荤菜”",
        "id":"1369717684"
      },
      {
        "image":"http://p1.music.126.net/4FNfMce1PZNQJ0SDFQ7mVg==/18701593279048718.jpg?param=140y140",
        "title":"Chicano Rappers墨裔美国说唱歌手",
        "id":"2186584109"
      },
      {
        "image":"http://p1.music.126.net/htzfmk-3AwXnc7YeeDMTHQ==/109951163349695329.jpg?param=140y140",
        "title":"这个世界上，任何一次拥抱都以松手告终",
        "id":"1369701846"
      },
      {
        "image":"http://p1.music.126.net/Pr2CZRy5rKZrX3MOj04qNQ==/19147994998306584.jpg?param=140y140",
        "title":"运动嗨曲",
        "id":"2150565593"
      },
      {
        "image":"http://p1.music.126.net/3bvgi1jMJcTwIAl72niz6A==/19213965695974109.jpg?param=140y140",
        "title":"走马-摩登兄弟",
        'id':"1368891329"
      }
      ,

      {
        "image":"http://p1.music.126.net/ai30tQ0lGHzmQAESsc9R4w==/109951163355269381.jpg?param=140y140",
        "title":"如歌记 | 回忆我，带着笑或是很沉默",
        "id":"2255791428"
      },
      {
        "image": "http://p1.music.126.net/YQQ4ixUjY8A8I_qh2k2wuA==/19187577416921555.jpg?param=140y140",
        "title": "『古风』风猎池塘雨沾裳，轻枕竹床午梦长",
        "id":"2184003781"
      },
      {
        "image": "http://p1.music.126.net/-OUVL9LDjtQgHAykR8PsBQ==/19220562765758800.jpg?param=140y140",
        "title": "提及年少一词，应与平庸相斥",
        'id':"2255796408"
      },
      

      
      {
          "image": "http://p1.music.126.net/RqsJE6oJsLiP1uYqecjc0w==/109951163356213216.jpg?param=140y140",
          "title": "那些年，爸爸爱听的歌",
          "id":"2267179853"
      },
      {
          "image": "http://p1.music.126.net/ai30tQ0lGHzmQAESsc9R4w==/109951163355269381.jpg?param=140y140",
          "title": "如歌记 | 回忆我，带着笑或是很沉默",
          "id":"2255791428"
      },
      {
          "image": "http://p1.music.126.net/2U5zjlqqtwBu4sc_lojstQ==/18989665323609548.jpg?param=140y140",
          "title": "「日系」前奏控|舒缓中的温柔等待一个相遇",
          "id":"873407406"
      },
   

      
      {
          "image": "http://p1.music.126.net/Vxsf58sMyNjqnWVZa9Wbfw==/18991864347187831.jpg?param=140y140",
          "title": "『Dreamy Noise Therapy』梦幻噪音治愈手册",
          "id":"2215267824"
      },
      {
          "image": "http://p1.music.126.net/gL0T_M15_6f1xyb3J7AD3w==/18572950418611970.jpg?param=140y140",
          "title": "复古青年爱听酷酷的歌°",
          "id":"2266206105"
      },
      {
          "image": "http://p1.music.126.net/TsTuvSHQunwAP7GgoLL9sg==/109951163322657750.jpg?param=140y140",
          "title": "励志摇滚 · 人生本是永无止境的攀登",
          "id":"2246462833"
      },
      

    ];
    var chartsList=[
      {
        "title":"云音乐特色榜",
        "list":[
          {
            "id":"19723756",
            "image":"http://p1.music.126.net/DrRIg6CrgDfVLEph9SNh7w==/18696095720518497.jpg?param=40y40",
            "desc":"云音乐排行榜"
          },
          {
            "id":"3779629",
            "image":"http://p1.music.126.net/N2HO5xfYEqyQ8q6oxCw8IQ==/18713687906568048.jpg?param=40y40",
            "desc":"云音乐新歌榜"
          },
          {
            "id": "2884035",
            "image": "http://p1.music.126.net/sBzD11nforcuh1jdLSgX7g==/18740076185638788.jpg?param=40y40",
            "desc": "网易原创歌曲榜"
          },
          {
            "id": "3778678",
            "image": "http://p1.music.126.net/GhhuF6Ep5Tq9IEvLsyCN7w==/18708190348409091.jpg?param=40y40",
            "desc": "云音乐热歌榜"
          }
        ]
      },
      {
        "title":"全球媒体榜",
        "list":[
          {
            "id": "1978921795",
            "image": "http://p1.music.126.net/5tgOCD4jiPKBGt7znJl-2g==/18822539557941307.jpg?param=40y40",
            "desc": "云音乐电音榜"
          },
          {
            "id": "991319590",
            "image": "http://p1.music.126.net/RChr5NydlXafIV1GVEHJdg==/19073228207465342.jpg?param=40y40",
            "desc": "云音乐嘻哈榜"
          },
          {
            "id": "2250011882",
            "image": "http://p1.music.126.net/bZvjH5KTuvAT0YXlVa-RtQ==/109951163326845001.jpg?param=40y40",
            "desc": "抖音排行榜"
          },
          {
            "id": "2023401535",
            "image": "http://p1.music.126.net/0_6_Efe9m0D0NtghOxinUg==/109951163089272193.jpg?param=40y40",
            "desc": "英国Q杂志中文版周榜"
          },
          {
            "id": "2006508653",
            "image": "http://p1.music.126.net/CUqQp33MZf_m0BwH4u0V6A==/109951163078922993.jpg?param=40y40",
            "desc": "电竞音乐榜"
          },
          {
            "id": "10520166",
            "image": "http://p1.music.126.net/qN-sDLqehN1oHGyov-0EZw==/109951163068669685.jpg?param=40y40",
            "desc": "云音乐新电力榜"
          },
          {
            "id": "71385702",
            "image": "http://p1.music.126.net/vttjtRjL75Q4DEnjRsO8-A==/18752170813539664.jpg?param=40y40",
            "desc": "云音乐ACG音乐榜"
          },
          
        ]
      }
    ];
    var singerList=[
      {
        "title":"华语",
        "list":[
          {
            "image":"",
            "desc":"华语男歌手",
            "id":"1001"
          },
          {
            "image": "",
            "desc": "华语女歌手",
            "id": "1002"
          },
          {
            "image": "",
            "desc": "华语组合/乐队",
            "id": "1003"
          }
          ]
      },
      {
        "title":"欧美",
        "list": [
          {
            "image": "",
            "desc": "欧美男歌手",
            "id": "2001"
          },
          {
            "image": "",
            "desc": "欧美女歌手",
            "id": "2001"
          },
          {
            "image": "",
            "desc": "欧美组合/乐队",
            "id": "2003"
          }
        ]
      },
      {
        "title": "日本",
        "list": [
          {
            "image": "",
            "desc": "日本男歌手",
            "id": "6001"
          },
          {
            "image": "",
            "desc": "日本女歌手",
            "id": "6002"
          },
          {
            "image": "",
            "desc": "日本组合/乐队",
            "id": "6003"
          }
        ]
      },
      {
        "title": "韩国",
        "list": [
          {
            "image": "",
            "desc": "韩国男歌手",
            "id": "7001"
          },
          {
            "image": "",
            "desc": "韩国女歌手",
            "id": "7002"
          },
          {
            "image": "",
            "desc": "韩国组合/乐队",
            "id": "7003"
          }
        ]
      },
      {
        "title": "其他",
        "list": [
          {
            "image": "",
            "desc": "其他男歌手",
            "id": "4001"
          },
          {
            "image": "",
            "desc": "其他女歌手",
            "id": "4002"
          },
          {
            "image": "",
            "desc": "其他组合/乐队",
            "id": "4003"
          }
        ]
      }
    ];
    var newDishList=[
      {
        "image":"http://p4.music.126.net/vmCcDvD1H04e9gm97xsCqg==/109951163350929740.jpg?param=130y130",
        "title":"平凡的一天",
        "id":"39483040"
      },
      {
        "image": "http://p3.music.126.net/bBM_SiadR2t44kJfNLgTpw==/109951163302888245.jpg?param=130y130",
        "title": "E能量",
        "id": "38984032"
      },
      {
        "image": "http://p3.music.126.net/dKrnDn-jPQ1Gm4eQPI35tw==/109951163349808365.jpg?param=130y130",
        "title": "Red Diary Page.2",
        "id": "38988130"
      },
      {
        "image": "http://p3.music.126.net/w6XSrAvUXrU_VSI8_H29MA==/109951163317131519.jpg?param=130y130",
        "title": "我有多么喜欢你",
        "id": "39216770"
      },
      {
        "image": "http://p4.music.126.net/qEyQhqGR3qP1nCBxU7_0dQ==/109951163332645756.jpg?param=130y130",
        "title": "天地",
        "id": "39564043"
      },
      {
        "image": "http://p4.music.126.net/5-7H2abcxgwSQoE3jP1g_A==/109951163315260754.jpg?param=130y130",
        "title": "Shawn Mendes",
        "id": "39322036"
      },
      
      {
        "image": "http://p3.music.126.net/BRq1VI4EgUVYY3lFA4IITg==/109951163298379812.jpg?param=130y130",
        "title": "LOVE YOURSELF 轉 'Tear'",
        "id": "38595209"
      },
      {
        "image": "http://p3.music.126.net/DnTvmdHlL6laM3vIV-V06w==/109951163298316770.jpg?param=130y130",
        "title": "李志、电声与管弦乐II",
        "id": "38272114"
      },
      {
        "image": "http://p3.music.126.net/6zcH_ecshqXwCl8LsxmoEg==/109951163351782860.jpg?param=130y130",
        "title": "繁华梦",
        "id": "39592227"
      },
      {
        "image": "http://p3.music.126.net/XWMiED2ryCj2xVovjDRDSQ==/109951163281594877.jpg?param=130y130",
        "title": "Voicenotes",
        "id": "38530129"
      },
    ];
    this.setData({
      groomList:groomList,
      cartsList:chartsList,
      singerList:singerList,
      newDishList:newDishList
    });
  },
  
  onChangNavBar:function(e){
    var index=main.getDataSet(e,"index");
    this.setData({
      currentIndex:index
    });
  },

  onTap:function(e){
    var id=main.getDataSet(e,"id");
    this.setData({
      currentId:id
    });
    wx.navigateTo({
      url:'../songList/songList?id='+id,
    });
  },

  onConfirm:function(e){
    var value=e.detail.value;
    wx.navigateTo({
      url: '../songList/songList?from=index&search='+value,
    });
  },

  onShow:function(){
    if(app.globalData.close){
      wx.showModal({
        title: '提示',
        content: '是否退出小程序',
        showCancel:true,
        success:(res)=>{
          if(res.confirm){
            wx.reLaunch({
              url: '../success/success',
            });
          }
        }
      });
    }
  },

  onShareAppMessage:function(res){
    return {
      title:"网易云音乐",
      path:"/pages/index/index",
      imageUrl:"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1529336272394&di=e410e2b2dd5b8c458e35149d509357d0&imgtype=0&src=http%3A%2F%2Fimg04.tooopen.com%2Fimages%2F20120915%2Ftooopen_201209150235224467.jpg"
    }
  }
})
